//package com.test.dubbo;
//
//import com.user.entity.emp.Emp;
//import com.user.service.emp.EmpService;
//import org.apache.dubbo.config.ApplicationConfig;
//import org.apache.dubbo.config.ReferenceConfig;
//import org.apache.dubbo.config.RegistryConfig;
//import org.apache.dubbo.rpc.cluster.specifyaddress.Address;
//import org.apache.dubbo.rpc.cluster.specifyaddress.UserSpecifiedAddressUtil;
//
///**
// * dubbo接口调用
// *
// */
//public class DubboCall {
//    public static void main(String[] args) {
//        ReferenceConfig<EmpService> referenceConfig = new ReferenceConfig<>();
//        ApplicationConfig applicationConfig = new ApplicationConfig();
//        applicationConfig.setName("dubbo-call-consumer");
//        referenceConfig.setVersion("1.0.0");
//        referenceConfig.setApplication(applicationConfig);
//        //创建注册中心配置
//        RegistryConfig registryConfig = new RegistryConfig();
//        registryConfig.setAddress("zookeeper://10.70.5.11:2181?backup=10.70.5.12:2181,10.70.5.13:2181");
//        referenceConfig.setRegistry(registryConfig);
//        referenceConfig.setInterface(EmpService.class.getName());
//        EmpService demoService = referenceConfig.get();
//        // for invoke
//        // 1. find 10.10.10.10:20880 exist
//        // 2. if not exist, create a invoker to 10.10.10.10:20880 if `needToCreate` is true (only support in Dubbo 3.x's implementation)
//        // 直连
//        UserSpecifiedAddressUtil.setAddress(new Address("10.70.5.47", 20886, true));
//        Emp emp = demoService.selectByCode("H023462");
//        System.out.println(emp);
//    }
//}
